package com.jiaquyun.jcyx.main.mine

import com.blankj.utilcode.util.ActivityUtils
import com.blankj.utilcode.util.SPStaticUtils
import com.jiaquyun.jcyx.R
import com.jiaquyun.jcyx.main.user.AccessActivity
import com.jiaquyun.jcyx.popup.SettingExitPopup
import com.module.lemlin.owner.OwnerAbstractActivity
import kotlinx.android.synthetic.main.activity_mine_setting.*

class MineSettingActivity : OwnerAbstractActivity() {

    companion object {
        fun open() {
            ActivityUtils.startActivity(MineSettingActivity::class.java)
        }
    }

    private val mSettingExitPopup: SettingExitPopup by lazy {
        SettingExitPopup(context = this, onClick = {
            if (it.id == R.id.tvSettingExitClose) {
//                SPStaticUtils.clear()
                ActivityUtils.finishAllActivities()
            }
            AccessActivity.open(activity = this)
        })
    }

    override val layoutResId: Int
        get() = R.layout.activity_mine_setting

    override fun stateBar(): StatusBar {
        return StatusBar(isLightMode = true, color = R.color.white,view = flMineSettingBar)
    }

    override fun initView() {

        ivAppBack.setOnClickListener { finish() }

        //用户服务协议
        tvMineSettingAgreeService.setOnClickListener {
            MineRichTextActivity.openId(activity = this, title = "用户服务协议", id = 1)
        }
        //用户隐私政策
        tvMineSettingAgreeHide.setOnClickListener {
            MineRichTextActivity.openId(activity = this, title = "用户隐私政策", id = 5)
        }
        //企业资质
        tvMineSettingEnterprise.setOnClickListener {
            MineRichTextActivity.openId(activity = this, title = "企业资质", id = 20)
        }

        //退出登录
        tvMineSettingExit.setOnClickListener {
            mSettingExitPopup.showPopupWindow()
        }

    }

}